# Copyright (c) 2018 Presto Labs Pte. Ltd.
# Author: xguo

import tabulate

from coin.base.timestamp import get_timestamp


def print_working_orders(logger, order_gateway):
  pass
  # headers = [
  #     'order_id',
  #     'exchange_order_id',
  #     'product',
  #     'price',
  #     'qty',
  #     'side',
  #     'accepted',
  #     'cancel_sent',
  #     'age'
  # ]

  # table = []
  # timestamp_now = get_timestamp()
  # for order in order_gateway.get_working_order():
  #   try:
  #     age = int((timestamp_now - order.internal.timestamp) / 1e9)
  #   except (AttributeError, TypeError):
  #     age = 'N/A'

  #   exchange_order_id = (getattr(order.internal, 'exchange_order_id', None)
  #                        or getattr(order.internal, 'server_order_id', None) or 'N/A')

  #   table.append([
  #       order.order_id,
  #       exchange_order_id,
  #       order.product.symbol,
  #       order.price,
  #       order.qty,
  #       order.order_side.name,
  #       order.accepted,
  #       order.cancel_sent,
  #       age
  #   ])
  # fmt_table = tabulate.tabulate(table, headers, floatfmt=".8f", stralign="right")
  # logger.info('----- working orders (%s)\n%s', order_gateway.exchange, fmt_table)
